<template>
  <div>
    <el-row :gutter="6">
      <el-form label-width="auto">
        <el-col :span="4" :offset="1">
          <el-form-item label="提供者">
            <!--            <el-input v-model="supplyNickname"></el-input>-->
            <el-tag type="warning" effect="plain">{{
              supplier.nickname
            }}</el-tag>
            <!--            <el-input v-model="suppler.nickname"></el-input>-->
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="获得者">
            <!--            <el-input v-model="consumerNickname"></el-input>-->
            <!--            <el-input v-model="consumer.nickname"></el-input>-->
            <el-tag
              type="danger"
              effect="plain"
              v-text="consumer.nickname"
            ></el-tag>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="数量">
            <el-input v-model.number="dealBill.quantity"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="交易信息">
            <el-input v-model="dealBill.dealNote"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="2">
          <el-button @click="dealBillSubmit">提交</el-button>
        </el-col>
      </el-form>
    </el-row>
  </div>
</template>

<script>
// import New from './components/New.vue';
export default {
  name: "GoldCoinDeal",
  components: {
    // New,Old,
  },
  props: {
    sampleP: {
      type: Number,
      default: 0,
    },
    // <!--    "playerId": 84,-->
    // <!--    "playerCode": "8116666",-->
    // <!--    "nickname": "马宜泽",-->
    // <!--  "silverCoin": 66,-->
    // <!--    "profession": "writer",-->
    // <!--    "usernameFk": "2016207099",-->
    // <!--    "version": 1  "goldCoin": 94,-->
    // <!--    -->
    supplier: {
      type: Object,
    },
    consumer: {
      type: Object,
    },
  },
  data() {
    return {
      sampleD: "value",
      dealBill: {
        consumerCode: "",
        supplierCode: "",
        quantity: 0,
        dealNote: "",
        dealState: "willing",
        dealBillId: 0,
        dealTime: "2021-09-17T07:38:48.033Z",
        version: 0,
      },
    };
  },
  computed: {
    // sampleC() {
    //     return this.sampleD+'--';
    // }
  },
  created() {},
  mounted() {},
  methods: {
    sampleM() {},
    dealBillSubmit() {
      // this.supplier.supplierCode=newValue.playerCode;
      // this.consumer.consumerCode=newValue.playerCode;
      this.$http({
        method: "post",
        url: "/ceto/dealBill/insert",
        data: this.dealBill,
      }).then(
        (res) => {
          this.$message.warning(JSON.stringify(res.data));
          if (res.data) {
            this.$emit("postSubmit");
          }
        },
        (error) => {
          console.log(".dealBill request error : " + error.response.status);
        }
      );

      //this.$message.success(JSON.stringify())
    },
  },
  //观测值的改变
  watch: {
    supplier(newValue, oldValue) {
      this.dealBill.supplierCode = newValue.playerCode;
    },
    consumer(newValue, oldValue) {
      this.dealBill.consumerCode = newValue.playerCode;
    },

    // sampleC(newValue, oldValue) {
    //
    // }
  },
};
</script>

<!--<style scoped>-->
<style lang="scss" scoped></style>
